#include "CommandConcrete.h"
#include <QDebug>

#include "UI/ModRun/Output/FactoryOutput.h"

CommandConcrete::CommandConcrete(std::shared_ptr<Receiver> pReceiver)
{
    m_pReceiver = pReceiver;
}

CommandConcrete::~CommandConcrete()
{

}

void CommandConcrete::execute()
{
    QString strOutput = "CommandConcrete::execute:执行命令";
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }

    if (m_pReceiver)
    {
        m_pReceiver->Action();
    }
}

void CommandConcrete::cancel()
{
    QString strOutput = "CommandConcrete::cancel:撤销命令";
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }
}

